home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1998 June / SGI Freeware 1998 June.iso / dist / fw_UMINNgopher.idb / usr / freeware / src / gopher_1.12 / gopher / subprocs.c.z / subprocs.c
C/C++ Source or Header  |  1997-09-09  |  2KB  |  92 lines

  1. /********************************************************************
  2.  * $Author: drich $
  3.  * $Revision: 1.1 $
  4.  * $Date: 1995/10/03 04:08:16 $
  5.  * $Source: /proj/freeware1.0/gopher1.12/src/gopher/RCS/subprocs.c,v $
  6.  * $State: Exp $
  7.  *
  8.  * Paul Lindner, University of Minnesota CIS.
  9.  *
  10.  * Copyright 1991, 1992 by the Regents of the University of Minnesota
  11.  * see the file "Copyright" in the distribution for conditions of use.
  12.  *********************************************************************
  13.  * MODULE: subprocs.c
  14.  * procedures for dealing with child processes.
  15.  *********************************************************************
  16.  * Revision History:
  17.  * $Log: subprocs.c,v $
  18.  * Revision 1.1  1995/10/03  04:08:16  drich
  19.  * gopher 1.2 check-in
  20.  *
  21.  * Revision 1.2  1992/12/31  05:36:51  lindner
  22.  * Mods for VMS
  23.  *
  24.  * Revision 1.1  1992/12/10  23:32:16  lindner
  25.  * gopher 1.1 release
  26.  *
  27.  * Revision 1.1  1992/12/10  06:16:51  lindner
  28.  * Initial revision
  29.  *
  30.  *
  31.  *********************************************************************/
  32.  
  33. #ifdef VMS
  34. void
  35. sig_child()
  36. { }
  37. setsighandler()
  38. { }
  39.  
  40. #else /* not VMS */
  41.  
  42.  
  43. #include "gopher.h"
  44.  
  45. #include "Wait.h"
  46.  
  47. #if defined(SIGTSTP) && !defined(_CRAY)   /* True on a BSD system */
  48. #include <sys/file.h>
  49. #endif
  50.  
  51. #include <sys/ioctl.h>
  52.  
  53. /* A little signal handler that handles those damn zombies */
  54.  
  55.  
  56. void
  57. sig_child()
  58. {
  59.      /*
  60.       * Use the wait3() system call with the WNOHANG option
  61.       */
  62.  
  63.      int pid;
  64.  
  65.      Portawait status;
  66.  
  67.      while ( (pid = wait3(&status, WNOHANG|WUNTRACED, NULL)) > 0)
  68.       ;
  69. }
  70.  
  71.  
  72. #ifdef SIGCHLD
  73. #ifndef SIGCLD
  74. #  define SIGCLD SIGCHLD
  75. #endif
  76. #endif
  77.  
  78.  
  79. setsighandler() 
  80. {
  81.           
  82. #if defined(SIGTSTP) && !defined(_CRAY)
  83.      signal(SIGCLD, sig_child);  /* BSD */
  84. #else
  85.      signal(SIGCLD, SIG_IGN);
  86. #endif
  87.  
  88.  
  89. }
  90.  
  91. #endif  /* not VMS */
  92.